"use strict";

const { resolve, reject } = require("bluebird");
var Promise = require("bluebird");

// var first = function(){
//     console.log("first");
// };

// var second = function(){
//     console.log("second");
// }

// var third = function(){
//     console.log("third");
// }

// Promise.resolve().then(first).then(second).then(third);


// var first = function(){
//   console.log("first");
// };
// // 修改second方法为异步方法
// var second = function(){
//   setTimeout(function() {
//     console.log("second");
//   },1000);
// }

// var third = function(){
//   console.log("third");
// }

// Promise.resolve().then(first).then(second).then(third);

var first = function(){
  console.log("first");
};
// 修改second方法为Promise方法
var second = function(){
  return new Promise((resolve, reject) => {
    setTimeout(function() {
      console.log("second");
      resolve();
    },1000);
  })
}

var third = function(){
  console.log("third");
}

Promise.resolve().then(first).then(second).then(third);